Emulator for an SQL relational-database

ABSTRACT

Method and means for porting an existing application (An) using a relational-database with SQL interface toward a hardware platform (HW2) with a reduced software configuration which does not include an SQL relational-database. The invention emulates an SQL database enabling hardware resources saving and providing a subset of functions for: creating SQL tables and defining fields; storing, modifying and deleting data on created tables, with a type check, retrieving such data by using SQL filters. Functions can be subdivided into levels (M1, M2, M3) in order to: convert an SQL statement, coming from an existing user application (An), into a sequence of elementary interface functions (IF1 . . . IFn), use said interface functions to read/write data files (F1 . . . Fn), process output data to be supplied to the requesting user application (An).

BACKGROUND OF THE INVENTION

1. Technical Field

The present invention relates to a method of providing a subset of SQL(Structured Query Language) relational-database functions to existingapplications.

2. Discussion of Related Art

There still exist a variety of commercially available databases with SQLinterface, providing an exhaustive set of functions, but they are highlyhardware resource consuming.

As a result, computer programs written for one computer with a softwareplatform including a commercial SQL relational-database are frequentlyunsuitable for use with computers having a reduced hardwareconfiguration.

In the past many existing applications had to be rewritten in order toenable them to interface with a proprietary database resident on thatequipment.

Furthermore proprietary databases are usually equipment dependent andcannot be used for the same or other applications on other equipment.

One of the major problems that application developers are faced withwhen porting existing applications, developed on a different hardwareand software platforms and using an SQL relational-database, towardequipment with reduced hardware configuration, for example communicationservers, other network apparatus etc., is the need to rewrite part ofthe applications in order to enable them to interface with a proprietarydatabase resident on that equipment, otherwise the applications couldnot be used or must be rewritten completely. Sometimes the destinationequipment has a reduced availability of hardware resources because ofthe installation of other resource consuming applications (e.g.,communication software like ISO/OSI stack protocols, TCP/IP and others)and since commercial SQL relational-databases are highly hardwareresources consuming it could be desirable to avoid installing it, forexample in the case of the porting of an application toward one or morecommunication servers.

It will be recognized that an SQL database running on any equipment withany configuration is essential in order to allow an existing applicationusing an SQL database to be ported toward an equipment and to functioncorrectly, when a commercial database has not been installed.

SUMMARY OF INVENTION

It is an object of the present invention to provide a method and meansof porting/supplying a set of SQL database functions to an existingapplication on any equipment, without a significant consumption ofhardware resources.

The object is attained by methods with the features according to claim 1or claim 5 and by means according to claim 7.

The invention as claimed enables the porting of existing user softwareapplications using an SQL database toward any reduced hardwareconfiguration on which a commercial resource consuming SQLrelational-database cannot be installed, by only copying, recompilingand executing the application files, without any source codemodification.

By using the invention, the waste of time to modify existing source codeis avoided, where sometimes such source code is not easily modifiableand would require a big effort.

Furthermore, it is sometimes preferable to save hardware resources forother run time applications, in these cases the emulator object of theinvention enables the saving in a configuration phase.

Furthermore, the emulator can be customized to be used with differentplatforms on any different equipment.

Further advantageous features of the invention are defined in thesubclaims.

Advantageously, security of user data can be guaranteed, when necessary,by using an encryption/decryption module to access data files.

BRIEF DESCRIPTION OF THE DRAWINGS

The invention will now be described in detail, by way of example, withreference to the accompanying drawings, in which:

FIG. 1 shows the use of the emulator during a porting phase;

FIG. 2 enumerate all parts which make up the software architecture ofthe emulator;

FIG. 3 shows how an SQL statement is converted into an interfacefunction which is then translated into a sequence of emulation libraryfunctions accessing the ASCII files;

FIG. 4 shows the implementation of how an SQL statement is convertedinto an interface function which is then translated into a sequence ofemulation library functions accessing the ASCII files; and

FIG. 4-B shows a special example of FIG. 4;

FIG. 5 shows a system for managing a telephone network, implementedusing a LAN network comprising communication servers of reduced hardwareconfiguration which can carry out the invention.

DETAILED DESCRIPTION OF PREFERRED EMBODIMENTS

This invention focuses on a database emulation approach, as shown inFIG. 1. In what follows, particular attention will be paid to theservice provided to the application needing the database though itshould be understood that emulator might implement a different set offunctions which will be the minimum required by the application in orderto work.

With the present invention an original method to provide theperformances of an SQL commercial database in a different way is given,by using an emulator 1.

Said emulator is a modular database: only the functions needed tosatisfy the requirements of an existing user application An areconfigured and installed, so to enable the maximum flexibility in orderto reduce the consumption of hardware resources, in particular memoryand CPU time.

The emulator manages configuration and user data ASCII files F1 . . . Fnby using a modular library of functions and predefined data structures.The simple modular structure enables an easy configuration upgrade andmaintenance, in order to reduce the emulator size taking intoconsideration the application requirements and the hardwareconfiguration of an equipment.

Said application An has, for example, been developed on a first hardwareplatform HW1 interfacing the application An toward the SQL relationaldatabase with a software configuration SW1, and it is supposed to beused on a second hardware platform HW2 where the SQL database is notavailable and thus SW1 is not usable.

The software architecture of the emulator 1 is shown in FIG. 2.

The emulator 1 is composed of the following parts:

an Interface Module M1 providing the applications with an SQL interface(it takes the place of the SW1 platform). This module is applicationdependent and should be customized depending on the type of SQLstatements used, with particular regard to query statement having acomplex syntax. It includes a set of functions, one for each specificSQL statement used by the application An;

a modular Emulation Library M2, expandable and application independent,including a set of functions performing basic operations on the ASCIIfiles, invoked by M1 in order to implement the SQL statements used bythe application An;

an error management module (not shown in the figure);

an Encryption Module M3 (not mandatory);

configuration ASCII files including the database and tables definitionF1 . . . Fm-1; and

ASCII user data files Fm . . . Fn (which can be encrypted) including theuser data inserted according to the tables definition.

The emulator manages a number of ASCII files containing the tablesdefinition and the user applications data.

For security reasons data can optionally be encrypted.

Using the emulator, the CPU time dedicated and the amount of RAM memoryand hard disk number of Mbytes required is highly reduced, compared toexisting SQL databases.

The SQL relational-database emulator provides the user applications witha modular library including a set of functions to:

creating SQL tables and defining fields;

storing, modifying and deleting data on created tables, where a typecheck is performed according to the field definition; and

retrieving such data by using SQL filters;

The emulator implements the SQL commands in two different ways:

1. to define the database structure, the following table configurationcommands can be implemented by using an editor to update configurationfiles:

x create table

x modify table configuration

x drop table

x description

insert row to pre-populate the table

2. to use the defined database, the run-time modification of tablecontent is realized by using the Module Interface functions IF1 . . .IFn, as shown in FIG. 3:

select rows;

insert one row;

delete rows;

update one row.

This description will continue to take as an example an SQL databasewhose services are to be emulated.

Before proceeding to a detailed description of the invention, it wouldbe helpful to outline certain relevant aspects of the tablesconfiguration phase.

It will be described in the manner in which the following SQL statementsare handled:

create table (II),

modify table configuration (alter/drop/create)(I, III, II),

delete (alter/drop)(I, III),

description (IV)

insert row to pre-populate the table (V).

The SQL syntax of the aforesaid statements is the following:

I) to modify a database:

ALTER DATABASE database₋₋ name;

II) to define a new table structure:

CREATE TABLE table₋₋ name (field₋₋ name1 NUMBER (9),

field₋₋ name2 CHAR (14));

III) to delete a table:

DROP TABLE table₋₋ name

IV) to see the table definition:

DESC table₋₋ name

V) data inserted as default:

INSERT INTO table₋₋ name (field₋₋ name1, field₋₋ name2) VALUES (`field₋₋value1`, `field₋₋ value2`);

The aforesaid mentioned SQL statements can be emulated by using an ASCIIconfiguration file written and modified by using an editor.

For each new table an ASCII file is created.

Each row defines a column of the table.

The following is an example of table on an emulator table configurationASCII file, where the first part is the table structure definition andthe second part is the user data inserted as default.

The characters "", "-" and "*" are used to divide data.

The character "#" indicates that there is a comment line.

In the first part the table structure is defined.

The data included between H . . . H represents the table definition, andeach row starting with a C is a column of the defined table.

The specified parameters define for each table column the:

x type,

x length,

x if the field can be null,

x if the field is a unique index to access to the records.

In the second part of this example, rows with data are inserted into thetable.

A type check is performed according to the previous table definition.

    ______________________________________                                        # Table ASH.sub.-- STATES                                                     #                                                                             H This table has 4 columns.linevert split.4.linevert split.                   #                                                                             C Application Service Id.                                                                   .linevert split.NUMBER.linevert split.3.linevert split.NOT                    NULL.linevert split.UNIQUE INDEX.linevert split.                C Appiication Entity Name                                                                   .linevert split.CHAR.linevert split.32.linevert split.NOT                     NULL.linevert split.UNIQUE INDEX.linevert split.                C Sequence Number                                                                                  .linevert split.NUMBER.linevert split.3.linevert                       split.NOT NULL.linevert split.UNIQUE INDEX.linevert split.      C StateName               .linevert split.CHAR.linevert split.20.linevert                   split.NOT NULL.linevert split.                                  H                                                                             #                                                                             * 1.linevert split.dh.sub.-- 1.linevert split. 0.linevert split.IDLE.linev    ert split.                                                                    * 1.linevert split.dh.sub.-- 1.linevert split. 1.linevert split.START.sub.    -- INT.sub.-- DIAL.sub.-- PEND .linevert split.                               * 1.linevert split.dh.sub.-- 1.linevert split. 2.linevert split.INT.sub.--     DIAL.sub.-- EXP .linevert split.                                             * 1.linevert split.dh.sub.-- 1.linevert split. 3.linevert split.INT.sub.--     DIAL.sub.-- PEND .linevert split.                                            * 1.linevert split.dh.sub.-- 1.linevert split. 4.linevert split.WAIT.sub.-    - FOR.sub.-- CONT .linevert split.                                            * 1.linevert split.dh.sub.-- 1.linevert split. 5.linevert split.WAIT.sub.-    - FOR.sub.-- LAST .linevert split.                                            * 1.linevert split.dh.sub.-- 1.linevert split.998.linevert split.PROVIDER.    sub.-- ABORT .linevert split.                                                 * 1.linevert split.dh.sub.-- 1.linevert split.999.linevert split.SUCCESFUL    .sub.-- COMPLETED .linevert split.                                            #                                                                             * 2.linevert split.bh.sub.-- 1.linevert split. 0.linevert split.IDLE          .linevert split.                                                              * 2.linevert split.bh.sub.-- 1.linevert split. 1.linevert split.COMMAND.su    b.-- EXPECTED .linevert split.                                                * 2.linevert split.bh.sub.-- 1.linevert split.998.linevert split.PROVIDER_    ABORT .linevert split.                                                        * 2.linevert split.bh#1.linevert split.999.linevert split.SUCCESFUL           COMPLETED .linevert split.                                                    #                                                                             ______________________________________                                    

The skilled man will be aware of still further configuration mode.

By way of further explanation, reference is directed to FIG. 3 which isin diagrammatic form.

An SQL statement, included in the user application, cause the activationof an emulator interface functions IFi, which invokes a sequence,depending on the specific SQL statement, of emulation library functionsLF1 . . . LFm accessing the ASCII files AF1 . . . AFk containing theuser data.

For example when the SQL statement INSERT INTO Tab2 (field₋₋name1,field₋₋ name2) VALUES (`field₋₋ value1`, `field₋₋ value2`); isinvoked by the user application An, the INSERT emulator interfacefunction IF1 is activated; it calls a sequence of emulation libraryfunctions accessing the Tab2 ASCII file AF2 containing the user data, asit will be explained in more detail later.

Another example is the following: when the SQL statement SELECT FROMTab2 is invoked by the user application An, the SELECTn emulatorinterface function IFn is activated; it calls a sequence of emulationlibrary functions accessing the Tab2 ASCII file.

A modular emulation library is available providing a set of functionsLF1 . . . LFm.

A subset of said functions can be combined to implement an SQLstatement.

An example of library functions is the following:

    ______________________________________                                        F1              .sub.-- get.sub.-- table.sub.-- descr                         F2               .sub.-- open.sub.-- table                                    F3               .sub.-- close.sub.-- table                                   F4               .sub.-- search.sub.-- first.sub.-- row                       F5               .sub.-- search.sub.-- next.sub.-- row                        F6               .sub.-- fetch.sub.-- row.sub.-- at.sub.-- curr.sub.--                        pos                                                           F7               .sub.-- fetch.sub.-- row.sub.-- at.sub.-- abs.sub.--                         pos                                                           F8               .sub.-- write.sub.-- row                                     F9               .sub.-- delete.sub.-- row                                    F10             .sub.-- refresh.sub.-- table.sub.-- file                      ______________________________________                                    

A detailed description of each function is provided later.

In FIG. 4 it is shown in details the implementation of one of theinterface functions IF1 . . . IFn aforesaid listed and shown in FIG. 3.

Said function is translated into a sequence of emulation libraryfunctions LF1 . . . LFm accessing the ASCII files.

Table Description A and Access Description B are defined in the dataarea of the function IFi; they are implemented as an array of recordshaving an element for each database table column.

Table Description A is a build up of the following configuration data:

1=column type,

2=column length,

3=whether the field can be null or not,

4=whether the field is an index to access to the records or not.

Access description B includes data about the access type and modedepending on the origin SQL statement type.

It is a build up of the following data, filled in by the emulatorInterface Function IFi depending on which columns the SQL statementuses:

1=use flag to indicate if the column is used (T=true, F=false)

2=string size,

and the following fields where to read/write the result of the operation(written by the ₋₋ fetch₋₋ row or read by the ₋₋ write ₋₋ row):

3=a flag indicating whether the field can be null or not (T=true,F=false),

4=a flag indicating whether the field contains a numeric value,

5=a flag indicating whether the field contains an alphanumeric value(char=character/ptr=pointer).

The first operation performed in RAM memory is the ₋₋ get ₋₋ table₋₋description function activation to retrieve from the database files theuser table definition and copy it in the Table Description A.Subsequently all the emulator library functions will use the TableDescription A to read/write the Access Description B.

An example of a system to manage a telephone network, implemented usinga LAN network comprising communication servers of reduced hardwareconfiguration which can carry out the invention, is shown in FIG. 5. Thesystem includes two Application Servers AS1 and AS2, one active and theother stand-by, performing management operations for a network; theseequipment have a full hardware and software configuration includingduplicated disks HD.

An Operator can interface the management system by using a so-called X₋₋Terminal connected to a X₋₋ Terminal Server providing a graphicaloperator interface.

A plurality of possible Communication Servers CS1 . . . CSn of reducedhw configuration are installed and can carry out the invention. Thenumber of communication servers CS1 . . . CSn with different hardwareconfiguration can increase in future upgrades of the network. On thecommunication server CS should be installed applications developed ondifferent hardware configuration equipment having a complete softwareplatform including a commercial database. As the reduced communicationserver CS software platform should include also communication softwareand since commercial SQL relational-databases are highly hardwareresources consuming, the emulation approach enables to spare memory andCPU time.

An example of a telephone network management system architecturecomprising network management systems according to FIG. 5, includingequipment which can carry out the invention.

The emulator approach can be useful in view of future extension of thenetwork by inserting an increasing number of equipment of differenthardware configuration on which applications needing an SQLrelational-database should be executed.

As the complexity of a network topology increases, the networkmanagement systems are supposed to be upgraded in terms of number ofequipment installed in applications running on said equipment.

The architecture of the network management system shown in FIG. 5 can besplit up in a plurality of cooperating sub-systems interconnectedthrough a network.

Network management systems SYSTEM1 SYSTEM2 and SYSTEM3 includingequipment having different configuration are interconnected to a networkto be managed in order to cooperate exchanging management information.

The emulation approach enables the porting of applications developed onfull hardware and software platforms toward any network equipment.

It has been mentioned above that every interface function IF1 . . . IFnaforesaid listed and shown in FIG. 3, is translated into a sequence ofemulation library functions LF1 . . . LFm accessing the ASCII files.

By way of further explanation, an SQL statement in the user applicationis converted into a IF function each IF function is associated to asequence of functions of the emulation library, where the sequencedepends from the SQL statement the output of the SQL command is returnedto the user application, as described above.

In the following will be examined in more detail:

1) IF functions

2) emulation library

3) ASCII files

An example of set of IF functions can be the following:

insert;

delete;

update;

select1; . . . ; and

selectn.

A SELECT statement, according to SQL syntax, can have a different WHEREclause. Here are some examples of different complexity. The character"*" means "ALL".

    ______________________________________                                        SELECT f1, f2 FROM tab1;                                                      SELECT*FROM tab1;                                                             SELECT f1, f5 FROM tab1 WHERE (f1=0 AND f2=`string`);                         SELECT f1, f5 FROM tab1                                                       WHERE (F1=0 AND f2 NOT IN                                                     (SELECT f3, f4 FROM tab2                                                       WHERE (f1=10 AND f2=`String1`)));                                            ((SELECT f1, f5 FROM tab1                                                     WHERE (F1=0 AND f2 NOT IN                                                     (SELECT f3, f4 FROM tab2 WHERE (f1=10 AND                                     f2=`string1`)))                                                               UNION                                                                         (SELECT f1, f5 FROM tab1                                                      WHERE (F1=0 AND f2 NOT IN                                                     (SELECT f3, f4 FROM tab2 WHERE (f1=10 AND                                     f2=`string1`)));                                                              )                                                                             );                                                                            ______________________________________                                    

The user application An interfaces the database using SQL statement andpassing parameters (pointers to data structure containing data sent tothe database and pointers to data structure in which the output of theSQL commands will be returned).

There will be described one of the aforesaid IF function, the onecorrespondent to the SELECT SQL statement, as far as its implementationis concerned.

TAB1 is an example of database table having 6 columns defined C1 . . .C6.

Two data lines have been inserted in TAB1; only the data relevant forthe example are written, the other field can have any value. TAB1:

    ______________________________________                                        C1    C2         C3     C4        C5  C6                                      ______________________________________                                        5                70     0         string                                      10               100    200       string                                      ______________________________________                                    

The following SQL statement can come from the user application An:SELECT c2, c4, c5 FROM tab1 WHERE (c2=10 AND c6=`string`);

There will be described how the emulator works to get results.

In this SELECT statement with this WHERE clause, the Access DescriptionTable B defined in FIG. 4, is duplicated in

Access Description Select B1 (not shown in figure),

Access Description Where B2 (not shown in figure).

In this case two different accesses to user data are made by using twoAccess Description tables. As explained before, every row of the TableDescription A and Access Description B or B1 and B2 corresponds to acolumn of the defined database table at the creation phase.

The Access Description Select B1 defines which fields among C1 . . . C6are to be retrieved for each data row selected from the ones present inTAB1 and should be sent to the application An, by tagging with T thefields of interest, in this case c1, c4, c5:

    ______________________________________                                        1             2     3          4    5                                         ______________________________________                                              use                                                                     C1    F                                                                       C2    T                           10                                          C3    F                                                                       C4    T                          100                                          C5    T                          200                                          C6    F                                                                       ______________________________________                                    

The Access Description Where B2 defines the clause to identify whichrows present in TAB1 should be selected, by tagging with T the fieldscited in the WHERE (c2=10 AND c6=`string`) clause:

    ______________________________________                                        1            2     3          4   5                                           ______________________________________                                              use                                                                     C1    F                                                                       C2    T                         10                                            C3    F                                                                       C4    F                                                                       C5    F                                                                       C6    T          5                  string                                    ______________________________________                                    

Another solution in a different SELECT statement, for example SELECTf1,f2 FROM tab1; could be performed by using a single access and asingle Access Description B. In FIG. 4-B is shown a special case of FIG.4. This is the case of the implementation of the following SQLstatement.

    ______________________________________                                        ((SELECT f1,f5 FROM tab1                                                      WHERE (F1=0 AND f2 NOT IN                                                     (SELECT f3, f4 FROM tab 2 WHERE (f1=10 AND                                    f2=`string1`)))                                                               UNION                                                                         (SELECT f1,f5 FROM tab1                                                       WHERE (F1=0 AND f2 NOT IN                                                     (SELECT f3,f4 FROM tab2 WHERE (f1=10 and f2=                                  `string`)));                                                                  )                                                                             );                                                                            ______________________________________                                    

which could be performed by using:

a multiple Table Description A1 and A2

a multiple Access Description B1 and B2.

In the following paragraph it will be explained how different steps areexecuted by the IFn SELECT function, by calling a definite sequence ofemulator library functions.

When the user application An asks the IFn for retrieving data from thedatabase, it sends to the emulator a pointer to a data structurecontaining parameters of the SQL SELECT statement and at the end of theoperation will be given back a pointer to the retrieved data result ofthe query.

A way for the IFn to perform the aforesaid task is the following:

1) the Table Description A, in the data area of FIG. 4, is initializedaccording to the table description read from the ASCII file containingthe configuration data, by calling the emulator library function ₋₋get₋₋ table₋₋ descr() LF in particular the array of structure of TableDescription A is filled in, one row for each table column;

2) the ASCII file containing user data related to the previouslyaccessed table configuration is opened the function verify whether thefile has not been opened before. If the file is opened for the firsttime:

opens the file

moves to the first row by calling the function ₋₋ search₋₋ next₋₋ row().

If not, a pointer to the file moves to the row by calling ₋₋ search₋₋next₋₋ row() and return a pointer to the row, cycling till:

the end of the file, or

the specified number of rows has been read;

3) for each row, it reads the row at current position by calling thefunction ₋₋ fetch₋₋ row₋₋ at₋₋ curr₋₋ pos()

and verify if the WHERE clause written in B2 is satisfied for that row,in this case the required fields of that user data row are copied in B1(SELECT Access Description), filling in the last three columns (null,long/int, char/ptr) according to the data type;

4) at the end close the user data table file.

As result of this function, the output of the SELECT clause will beavailable in the Access Description table (last three columns of B1) andwill be returned to the application An.

An example of EMULATION LIBRARY, as listed above, can be the following.

A subset of the functions can be combined to implement an SQL statement.In the following, a more detailed description of each function is given.

F1

NAME: ₋₋ get₋₋ table₋₋ descr

DESCRIPTION: It gets the table description for a specified table (inputparameter ₋₋ table₋₋ name), filling in the "row description" structure(output parameter ₋₋ row₋₋ desc). The proper table file is opened andclosed after the completion of the table description reading. It logs amessage when an error occurs.

F2

NAME: ₋₋ open₋₋ table

DESCRIPTION: It opens a table file for a specified table (inputparameter ₋₋ table₋₋ name). The file can be opened for read, update orappend depending on the specified "action type" (SELECT, DELETE andINSERT as specified by the input parameter ₋₋ action₋₋ type). It givesback to the calling function the pointer to the opened file (outputparameter ₋₋ file₋₋ ptr). It logs a message when an error occurs.

F3

NAME: ₋₋ close₋₋ table

DESCRIPTION: It closes a table file for a specified table name (inputparameter ₋₋ table₋₋ name). The file pointer is given by the callingfunction (input parameter ₋₋ file₋₋ ptr). It logs a message when anerror occurs.

F4

NAME: ₋₋ search₋₋ first₋₋ row

DESCRIPTION: It searches for the first row in a table. That means: theTable Description lines are skipped, as comment lines, till the secondHeader line (closing the Table Description) is found. It gets from thecalling function the file pointer (input parameter₋₋ file₋₋ ptr) and thetable name (input parameter ₋₋ table₋₋ name) that is inserted in theerror messages. If the row is correctly found it gives back to thecalling function the position of the row in the table file (outputparameter ₋₋ file₋₋ pos): it is the position of the line type char. Itassumes the initial value of the file pointer is pointing to the firstbyte of a file line, otherwise the search fails.

Last char got from the file:

first char of the row (when it has been correctly found

end-of-file found at the beginning of a line (no rows in the table)

an unexpected line first char

an unexpected end-of-file.

It logs a message when an error occurs.

F5

NAME: ₋₋ search₋₋ next₋₋ row

DESCRIPTION: It searches for the next row in a table. That means: TableDescription lines, if found, are treated as "unexpected lines". It getsfrom the calling function the file pointer (input parameter ₋₋ file₋₋ptr) and the table name (input parameter ₋₋ table₋₋ name) that isinserted in error messages. If the row is correctly found, it gives backto the calling function the position of the row in the table file(output parameter ₋₋ file₋₋ pos): it is the position of the line typechar. It assumes the initial value of the file pointer is pointing tothe first byte of a file line, otherwise the search fails.

Last char got from the file:

first char of the row (when it has been correctly found)

end-of-file found at the beginning of a line (no more rows in the table)

an unexpected line first char

an unexpected end-of-file.

It logs a message when an error occurs.

F6

NAME: ₋₋ fetch₋₋ row₋₋ at₋₋ curr₋₋ pos

DESCRIPTION: It fetches a table row starting from the current positionin the table file (position given by the calling function in the filepointer ₋₋ file₋₋ ptr). To scan the row it uses the row descriptiongiven by the calling function in the input parameter ₋₋ row₋₋ desc. Itfills in the "access structure" in the memory area of the callingfunction (parameter ₋₋ row₋₋ access). For more details, See the internalfunction ₋₋ fetch₋₋ row. It logs a message when an error occurs.

F7

NAME: ₋₋ fetch₋₋ row₋₋ at₋₋ abs₋₋ pos

DESCRIPTION: It fetches a table row starting from the positionexplicitly given by the calling function with the input parameter ₋₋file₋₋ pos (in addition to the file pointer ₋₋ file₋₋ ptr). To scan therow it uses the row description given by the calling function in theinput parameter ₋₋ row₋₋ desc. It fills in the "access structure" in thememory area of the calling function (parameter ₋₋ row₋₋ access). Formore details, See the internal function ₋₋ fetch₋₋ row. It logs amessage when an error occurs.

F8

NAME: ₋₋ write₋₋ row

DESCRIPTION: It logs a message when an error occurs. Input A and B. Itinserts a row in a table (the row is appended at the bottom of the filetable). It uses the row description given by the calling function asinput parameter. It takes the data to be written from the AccessDescription structure B given by the calling function as inputparameter. It opens and close the table file. It checks whether a rowwith the UNIQUE INDEX already exists in the table.

F9

NAME: ₋₋ delete₋₋ row

DESCRIPTION: It logically deletes a row in a table. The calling functionmust give the position of the row in the table. It updates the counterof deleted lines.

F10

NAME: ₋₋ refresh₋₋ table₋₋ file

DESCRIPTION: It checks, for a specified table, whether the deleted linescounter has reached the threshold or not. If yes, it rewrites the tablefiles without all lines that have been previously logically deleted. Thecounter is reset to 0 when the threshold is overcome and maintains thesame value when the value is less than the threshold.

F11

NAME: ₋₋ fetch₋₋ row

DESCRIPTION: It fetches a table row starting from the current positionin the table file (position given by the calling function in the filepointer ₋₋ file₋₋ ptr). To scan the row it uses the row descriptiongiven by the calling function in the input parameter ₋₋ row₋₋ desc. Itfills in the "access structure" in the memory area of the callingfunction (parameter ₋₋ row₋₋ access). It gets from the calling functionthe table name (parameter ₋₋ table₋₋ name) and the row number (parameter₋₋ row₋₋ nbr) that are inserted in the error messages. If no erroroccurs, the scanning terminates at the end-of-line after the lastcolumn. Otherwise, the scanning is aborted when the first error isdetected. It assumes the initial value of the file pointer is pointingto char immediately after the special char initiating the row.

Last char got from the file:

end-of-line terminating the last (or the unique) line composing the row(fetching successfully terminated),

column terminator of the last column fetched or bad char initiating aline or unexpected end-of-line or unexpected end-of-file (fetchingaborted).

It logs a message when an error occurs.

The described method of emulating an SQL relational-database in order tosimplify the porting of an existing application toward a destinationequipment is felt to have considerable advantages in terms of memory andCPU time saving.

I claim:
 1. A method of providing SQL relational-database functions toan application (An), comprising the following steps:converting SQLstatements assigned to a restricted subset of SQL relational-databasefunctions into interface functions (IF1 to IFn), which invokes dependingon the respective SQL statement a sequence of predefined emulationlibrary functions (LF1 to LFm) accessing user data, and building, from amodular set of said interface functions (IF1 to IFn) and respectivepredefined emulation library functions (LF1 to LFm), data managementroutines implementing only said restricted subset of SQL functions.
 2. Amethod as claimed in claim 1, wherein said emulation library functions(LF1 to LFm) provide basic operations on ASCII files (AF1 to AFk).
 3. Amethod as claimed in claim 2, wherein said emulation library functionsaccess configuration ASCII files including database and tablesdefinitions and ASCII user data files including the user data.
 4. Amethod as claimed in claim 1, wherein access to the user data is handledby an encryption/decryption module (M3).
 5. Method for porting anexisting application (An) using an SQL relational database towardreduced hardware configuration equipment (HW2), comprising the followingsteps:converting SQL statements assigned to a restricted subset of SQLrelational-database functions into interface functions (IF1 to IFn),which invokes depending on the respective SQL statement a sequence ofpredefined emulation library functions (LF1 to LFm) accessing user data,and building, from a modular set of said interface functions (IF1 toIFn) and respective predefined emulation library functions (LF1 to LFm),data management routines implementing only said restricted subset of SQLfunctions, and installing said data management routines as SQL emulatorfor said application (An) on the reduced hardware configuration (HW2).6. A method as claimed in claim 5, wherein the restricted subset of SQLfunctions is configured and reduced or increased as needed by theexisting application (An).
 7. Emulator (1) for providing of SQLrelational-database functions to an application (An) containinganinterface module (M1) formed by a set of interface function modules (IF1to IFn) each activated by a specific SQL statement, and an emulationlibrary (M2) formed by a set of emulation library functions modules (LF1to LFm) providing predefined emulation library functions for accessinguser data; wherein each interface function module (IF1 to IFn) isdesigned in such a way that it invokes depending on the respective SQLstatement the execution of a sequence of emulation library functions andby this implements data management routines for the respective SQLstatement, and wherein the interface module (M1) and the emulationlibrary (M2) contain a restricted number of said interface functionmodules (IF1 to IFn) and library function modules (LF1 to LFn),respectively, for implementing only a restricted subset of SQLfunctions.
 8. Emulator as claimed in claim 7, wherein the emulationlibrary (M2) contains library functions modules (LF1 to LFn)for creatingSQL tables and defining fields, for storing, modifying and deleting dataon created tables, where a type check is performed according to thefield definition, and for retrieving such data by using SQL filters.